package com.ruoyi.shop.api.factory;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.shop.api.domain.Shop;
import com.ruoyi.shop.api.RemoteShopService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 用户服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class RemoteShopFallbackFactory implements FallbackFactory<RemoteShopService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteShopFallbackFactory.class);

    @Override
    public RemoteShopService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteShopService()
        {


            @Override
            public TableDataInfo list(Shop shop) {
                System.out.println("商家shop表远程调用失败--list（）");
                return null;
            }

            @Override
            public AjaxResult getInfo(Long id) {
                System.out.println("商家shop表远程调用失败--getInfo（）");
                return null;
            }
        };
    }
}
